<?php
// src/Acme/UserBundle/Entity/User.php

namespace Caisse\UserBundle\Entity;

use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
//---New
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
use JMS\Serializer\Annotation\VirtualProperty;
//----Fin New

/**
 * @ORM\Entity
 * @ORM\Table(name="fos_user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Expose
     */
    protected $id;
     /**
     * @ORM\Column(name="nom", type="string", length=255)
      * @Expose
     */
    private $nom;

    /**
     * @ORM\Column(name="prenom", type="string", length=255)
     * @Expose  
     */
    private $prenom;
    
        /**
     * @ORM\Column(name="adresse", type="text")
     */
    private $adresse;
    
        /**
     * @ORM\Column(name="tel", type="integer")
     */
    private $tel;
    

   
    public function __construct()
    {
        parent::__construct();
        // your own logic
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nom
     *
     * @param string $nom
     * @return User
     */
    public function setNom($nom)
    {
        $this->nom = $nom;
    
        return $this;
    }

    /**
     * Get nom
     *
     * @return string 
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set prenom
     *
     * @param string $prenom
     * @return User
     */
    public function setPrenom($prenom)
    {
        $this->prenom = $prenom;
    
        return $this;
    }

    /**
     * Get prenom
     *
     * @return string 
     */
    public function getPrenom()
    {
        return $this->prenom;
    }

    /**
     * Set adresse
     *
     * @param string $adresse
     * @return User
     */
    public function setAdresse($adresse)
    {
        $this->adresse = $adresse;
    
        return $this;
    }

    /**
     * Get adresse
     *
     * @return string 
     */
    public function getAdresse()
    {
        return $this->adresse;
    }

    /**
     * Set tel
     *
     * @param integer $tel
     * @return User
     */
    public function setTel($tel)
    {
        $this->tel = $tel;
    
        return $this;
    }

    /**
     * Get tel
     *
     * @return integer 
     */
    public function getTel()
    {
        return $this->tel;
    }
    
    /**
     * Get the formatted name to display (NAME Prenom or username)
     * 
     * @param $separator: the separator between nom and prenom (default: ' ')
     * @return String
     * @VirtualProperty 
     */
    public function getUsedNom($separator = ' '){
        if($this->getNom()!=null && $this->getPrenom()!=null){
            return ucfirst(strtolower($this->getPrenom())).$separator.strtoupper($this->getNom());
        }
        else{
            return $this->getUsername();
        }
}
}